<?php
final class Str {
	const ENCODING = 'utf-8';

	public static function isNotEmpty($string) {
		return (bool)mb_strlen($string, self::ENCODING);
	}

	public static function size($string) {
		return (int)mb_strlen($string, self::ENCODING);
	}

	public static function substring($string, $begin, $length) {
		return (string)mb_substr($string, $begin, $length, self::ENCODING);
	}

	public static function isMatch($pattern, $string) {
		return (bool)preg_match('/'.$pattern.'/u', $string);
	}
}
?>